package com.szsh.aiot.hsm.controller;

import com.google.gson.JsonObject;
import com.szsh.aiot.common.annotation.CustomPermission;
import com.szsh.aiot.common.annotation.Log;
import com.szsh.aiot.common.core.domain.AjaxResult;
import com.szsh.aiot.common.core.domain.RequestDto;
import com.szsh.aiot.common.enums.BusinessType;
import com.szsh.aiot.hsm.service.DeviceSatusService;
import com.szsh.aiot.hsm.utils.PermitValidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description:设备上下线状态
 * @Date 2023/10/30: 14:02
 * @Author: LOADING>>>>>
 */

@Controller
@RequestMapping("/privacy")
public class DeviceOnlineStatusController {

    @Autowired
    private PermitValidUtil permitValidUtil;

    @Autowired
    private DeviceSatusService deviceSatusService;



    /**
     * 7.1.1 通过此接口可查询新设备上线提醒功能;
     *
     * @param requestDto 请求参数
     * @return 处理结果
     */
    @RequestMapping(value = "/deviceOnline/detail")
    @Log(title = "新设备在线状态查询功能", businessType = BusinessType.OTHER)
    @CustomPermission
    @ResponseBody
    public AjaxResult cameraAccessReminder(@RequestBody RequestDto requestDto) {
        String sequenceNo = requestDto.getSequenceNo();
        JsonObject requestParams = requestDto.getRequestJsonElement().getAsJsonObject();

        String broadbandNO = permitValidUtil.getElementValue(requestParams, "broadbandNO");
        return deviceSatusService.getDeviceOnline(broadbandNO);

    }
    }
